
#include <gomoku/core/State.h>

namespace gomoku
{

    Context::Context()
        : gui(0), black(0), white(0), referee(0)
    {}

    Context::Context(IGui *gui_, IPlayer *black_, IPlayer *white_, IReferee *referee_)
        : gui(gui_), black(black_), white(white_), referee(referee_)
    {}

    Context::Context(Context const & t)
        : gui(t.gui), black(t.black), white(t.white), referee(t.referee)
    {}

    Context &Context::operator=(Context const & t)
    {
        if (this != &t)
        {
            gui = t.gui;
            black = t.black;
            white = t.white;
            referee = t.referee;
        }
        return *this;
    }

    State::State(StateStack &stack, Context context)
        : _stack(&stack), _context(context)
    {}

    State::~State()
    {}

    void State::requestPush(StateID stateID)
    {
        _stack->pushState(stateID);
    }

    void State::requestPop()
    {
        _stack->popState();
    }

    void State::requestClear()
    {
        _stack->clearStates();
    }

    Context State::getContext() const
    {
        return _context;
    }

}